package com.lintrip.future;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RealData implements Data {

    public static final Logger logger = LoggerFactory.getLogger(RealData.class);

    private final String content;

    public RealData(int count,char c) {
        logger.info("Making ReadData ({}, {}) BEGIN",count,c);
        char[] buffer = new char[count];
        for (int i = 0; i < count;i++) {
            buffer[i] = c;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                logger.error("Construct RealData occur exception",e);
            }
        }
        logger.info("Making ReadData ({}, {}) END",count,c);
        this.content = new String(buffer);
    }

    @Override
    public String getContent() {
        return content;
    }
}
